import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import path from 'path';

export function svgIconsPlugin() {
  const plugin = createSvgIconsPlugin({
    iconDirs: [
      path.resolve(process.cwd(), 'src/visual/assets/icon'),
      path.resolve(process.cwd(), 'src/shared/assets/icon/svg'),
    ],
    symbolId: 'svg-icon-[dir]-[name]',
    /**
     * custom dom id
     * @default: __svg__icons__dom__
     */
    customDomId: '__hv__svg__icons__dom__' + new Date().getTime(),
    /**
     * 自定义插入位置
     * @default: body-last
     */
    // inject?: 'body-last' | 'body-first'
  });
  return plugin;
}
